﻿using System;
using System.Collections.Generic;
using DatabaseStuff;

namespace DatabaseStuff.Basic
{
    /// <summary>
    /// Basic implementation of a schema for a database table
    /// </summary>
    public class Schema: IDBSchema
    {
        private Field primaryKeyField;
        private IList<Field> fields;

        public Schema(IList<Field> _fields, Field _primaryKeyField)
        {
            primaryKeyField = _primaryKeyField;
            fields = _fields;
        }

        public IList<Field> Fields
        {
            get { return fields; }
        }

        public Field PrimaryKeyField
        {
            get { return primaryKeyField; }
        }

        public int NumFields
        {
            get { return fields.Count; }
        }

        IDBField IDBSchema.PrimaryKeyField
        {
            get { return primaryKeyField; }
        }

        IEnumerable<IDBField> IDBSchema.Fields
        {
            get { return fields; }
        }
    }
}
